﻿using DevExpress.XtraEditors;
using DevExpress.XtraGrid.Demos.util;
using DXApplicationTangche.Utils.UC;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DXApplicationTangche.UC.dataTable.UC
{
    public partial class XtraUserControlInt : DevExpress.XtraEditors.XtraUserControl
    {
        public XtraUserControlInt(ParaDefineDTO paraDefineDTO)
        {
            InitializeComponent();
            this.textBox1.Name = paraDefineDTO.paraId;
            this.layoutControlItem1.Text = paraDefineDTO.paraName;
        }

        private void textBox1_Validating(object sender, CancelEventArgs e)
        {
            if (!FunctionHelper.Is正整数(this.textBox1.Text))
            {
                MessageBox.Show("请输入正确数字！");
                this.textBox1.Clear();
                this.ActiveControl = this.textBox1;
                return;
            }
        }
        public override string ToString()
        {
            if (String.IsNullOrWhiteSpace(this.textBox1.Text.Trim()))
            {
                this.textBox1.Text = "0";
            }
            return this.textBox1.Text.Trim().ToString();
        }
    }
}
